<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>班主任本班学生</title>
    <link rel="stylesheet" href="/sybida/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/sybida/bs/bootstrap.min.css">
    <script src="/sybida/common/js/locahostadress.js" charset="utf-8"></script>
    <script src="/sybida/common/js/xlsx.full.min.js" charset="utf-8"></script>
</head>
<body>
<br>
<span>

</span>
<div style="border-bottom: #0C0C0C 1px solid;">当前位置：<a href="/" class="nav_guide">本班学生</a>
</div>
<div class="container">
    <br>
    <div class="layui-form-item">
        <label class="bg-success" style="line-height: 35px; font-size: 16px;">您的班级:&nbsp;</label>
        <select class="form-control" id="classNum" style="width: 100px; display: inline-block">

        </select>

        <button type="button" id="selectButt" class="btn btn-success">&nbsp;查&nbsp;&nbsp;询&nbsp;</button>
        <button type="button" id="abtn" class="btn btn-success">班级导出</button>
    </div>

    <table class="table table-striped table-hover table-bordered" id="showAllInfo">
        <tr class="active">
            <th scope="col"><input type="checkbox" id="chk">&nbsp;&nbsp;全选</th>
            <th>学生姓名</th>
            <th>学生性别</th>
            <th>是否毕业</th>
            <th>毕业学校</th>
            <th>专业</th>
            <th>微信</th>
            <th>就业城市</th>
            <th>手机号</th>
            <th>等级</th>
            <th scope="col">查看详情</th>
            <th scope="col">删除</th>
        </tr>
        <hr/>
    </table>

</div>
<div class="container" style="text-align: center">
    <nav aria-label="...">
        <ul class="pagination" id="pagination">
        </ul>
    </nav>
</div>
<div>
    <!--单个模态框-->
    <div class="modal fade" style="margin-top:100px;padding-top:100px;" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">

                <div class="modal-body" style="margin-top: 20px;">
                    <form>
                        <div class="form-group" >
                            <label id="messagetext" class="control-label">Message:</label>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button"  class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" id="deleteOneSure" class="btn btn-primary">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!--多个删除模态框-->
    <div class="modal fade" id="exampleModalAll" style="margin-top:100px;padding-top:100px;" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button>
                    <h4 class="modal-title" id="exampleModalLabel">删除</h4>
                </div>
                <div class="modal-body" style="margin-top: 20px;">
                    <form>
                        <div class="form-group">
                            <label id="mm" class="control-label">确认将所选的学生删除</label>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button"  id="canle" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" id="deleteAllSure" class="btn btn-primary">确认删除</button>
                </div>
            </div>
        </div>
</div>

</div>

<script src="/sybida/jquery/jquery-3.3.1.min.js"></script>
<script src="/sybida/bs/bootstrap.min.js"></script>
<script src="/sybida/layui/layui.js"></script>
<script src="/sybida/student/js/classStudent.js"></script>
<script src="/sybida/publicTool/js/dateutil.js"></script>
<script></script>
<script>
    var layer
    layui.use('layer', function(){
        layer = layui.layer;
    });
    $("#canle").click(function (){
        $("#exampleModalAll").attr("class","modal fade")
        $("#exampleModalAll").css("display","none")
    })
    $("#deleteAllSure").click(function (){

        var checkbox = $("input[name='optionAll']");
        var s=new Array();
        var j=0
        for(var i = 0;i<checkbox.length;i++)
        {
            if(checkbox[i].checked==true)
            {console.log(checkbox[i].value)
                s[j++]=(checkbox[i].value)
            }
        }
        var userid=getCookie("userid")
        if(s.length>0){ $.post({
            url:url+"/student/deleteallstudent",
            // 告知传递参数类型为json，不可缺少
            contentType:"application/json",
            data:JSON.stringify(s),
            beforeSend: function(request) {
                request.setRequestHeader("token", userid);
            },
            success:function(data){
                if(data== -1000){
                    location.href=logindexurl
                }else{
                    if(data.code===1){
                        location.href="/sybida/student/classStudent.html?pageNum=1&pageSize="+pageSize+"&userId="+userid

                    }else{
                        layer.alert("删除失败请重试！");
                        $("#exampleModalAll").attr("class","modal fade")
                        $("#exampleModalAll").css("display","none")
                    }
                }

            }
        })}else{

            layer.alert("所选数据为空！");
            $("#exampleModalAll").attr("class","modal fade")
            $("#exampleModalAll").css("display","none")
        }
    })
</script>
</body>
</html>